record Vec3[T] {
    x : T;
    y : T;
    z : T;
}

implement Vec3[U] {
    def add(self : Self, other : Self) : Self {
        return Vec3[T](self.x + other.x, self.y + other.y, self.z + other.z);
    }

    def dot(self : Self, other : Self) : T {
        return self.x * other.x + self.y * other.y + self.z * other.z;
    }
}

var a = Vec3[Int](1, 2, 3);
var b = Vec3[Double](100.0, 100.0, 100.1);

print(a.add(b));
print(a.dot(b));
